<?php

namespace app\api\model;

use app\common\enums\StatusEnum;

class LangClassVideoTransfer extends \app\common\model\LangClassVideoTransfer
{
    /**
     * 通过任务id获取转码记录
     * @return false|\think\db\Query[]
     * @throws \think\Exception\DbException
     */
    public static function getRecordByJobId($jobId)
    {
        $model = static::field('transter_file as transterFile,status')
            ->where(['job_id' => $jobId])
            ->find();
        return $model;
    }

    /**
     * 更新记录
     */
    public static function updateRecord($model,$status){
        $model->status = $status;
        $model->save();
    }

    /**
     * 通过文件查看是否有转码记录
     */
    public static function getRecordByFile($file,$type)
    {
        $model = static::field('transter_file as transterFile, file,status')
            ->where(['file' => $file,'type'=>$type])
            ->find();
        return $model;
    }
}